<HTML><HEAD><TITLE>make_suspension(+Goal, +Prio, -Susp)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Advanced Control and Suspensions</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>make_suspension(+Goal, +Prio, -Susp)</H1>
Make Goal a suspended goal with waking priority Prio and return the
corresponding suspension object in Susp.


<DL>
<DT><EM>Goal</EM></DT>
<DD>A Prolog Goal.
</DD>
<DT><EM>Prio</EM></DT>
<DD>A small integer.
</DD>
<DT><EM>Susp</EM></DT>
<DD>A variable.
</DD>
</DL>
<H2>Description</H2>
   The goal Goal is made a suspended goal, i.e. it enters the suspended
   part of the resolvent and shows up as a delayed goal.  When the debugger
   is on, a DELAY port is generated.
<P>
   A suspension can be in three states:
<PRE>
	State		Printed as
	---------------------------------
	sleeping	'SUSP-_123-susp'
	scheduled	'SUSP-_123-sched'
	dead		'SUSP-_123-dead'
</PRE>
<P>
   The Prio argument determines the priority with which the Goal will be
   scheduled when woken. It can be a positive number between 1 and 12,
   or zero, in which case the priority defaults to the priority setting
   of the predicate which is called in Goal.
<P>
   Note that a suspension is not a standard Prolog data structure and can
   only be manipulated in a restricted way.  In particular, a suspension is
   not an atom although it gets printed by default in the form
   'SUSP-_123-susp'.   The only way to create a suspension is with
   make_suspension/3,4, suspend/3,4 or by copying an existing suspension.
   The contents of a suspension can only be retrieved using get_suspension_data/3.
<P>

<H3>Modes and Determinism</H3><UL>
<LI>make_suspension(+, +, -) is det
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Goal is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Goal is not a callable term.
<DT><EM>(5) type error </EM>
<DD>Susp is not a variable.
<DT><EM>(5) type error </EM>
<DD>Prio is not an integer.
<DT><EM>(6) out of range </EM>
<DD>Prio is not a valid priority.
<DT><EM>(60) referring to an undefined procedure </EM>
<DD>Goal refers to an undefined precedure.
</DL>
<H2>Examples</H2>
<PRE>
[eclipse 1]: make_suspension(writeln(hello), 1, S), suspensions(Ss).

S = 'SUSP-_264-susp'
Ss = ['SUSP-_264-susp']

Delayed goals:
	writeln(hello)
Yes (0.00s cpu)


[eclipse 2]: make_suspension(true, 3, S), is_suspension(S), type_of(S,T).

S = 'SUSP-_272-susp'
T = goal


Delayed goals:
        true
Yes (0.00s cpu)
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/suspensions/suspend-3.html">suspend / 3</A>, <A HREF="../../kernel/suspensions/delayed_goals-1.html">delayed_goals / 1</A>, <A HREF="../../kernel/suspensions/insert_suspension-4.html">insert_suspension / 4</A>, <A HREF="../../kernel/typetest/is_suspension-1.html">is_suspension / 1</A>, <A HREF="../../kernel/suspensions/kill_suspension-1.html">kill_suspension / 1</A>, <A HREF="../../kernel/suspensions/schedule_suspensions-1.html">schedule_suspensions / 1</A>, <A HREF="../../kernel/suspensions/schedule_suspensions-2.html">schedule_suspensions / 2</A>, <A HREF="../../kernel/suspensions/get_suspension_data-3.html">get_suspension_data / 3</A>, <A HREF="../../kernel/compiler/set_flag-3.html">set_flag / 3</A>, <A HREF="../../kernel/suspensions/wake-0.html">wake / 0</A>
</BODY></HTML>
